package cn.etynit.mms.fallback;

import cn.etynit.domain.Inform;
import cn.etynit.exception.GlobalExceptionCodeEnum;
import cn.etynit.mms.feign.InformService;
import cn.etynit.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class InformServiceFallbackFactory implements FallbackFactory<InformService> {
    @Override
    public InformService create(Throwable throwable) {
        return new InformService() {
            @Override
            public JsonResult saveOrUpdate(Inform inform) {
                return JsonResult.error(GlobalExceptionCodeEnum.ERROR);
            }

            @Override
            public JsonResult list() {
                return JsonResult.error(GlobalExceptionCodeEnum.ERROR);
            }
        };
    }
}
